import Handsontable from "handsontable";

let htpublic = {
    language: "zh-CN", // 语言设置
    licenseKey: "non-commercial-and-evaluation", // 隐藏版权文字
    width: "auto", // 表格宽度
    height: "auto", // 表格高度、设置以后才会出现scroll
    // data: Handsontable.helper.createSpreadsheetData(10, 26), // 列表初始化数据
    data: [], // 表格数据也可根据实际项目需要进行设置
    startRows: 1, // 初始化行数,无data属性时生效(该值小于minRows时,以minRows为准)
    startCols: 3, // 初始化列数,无data属性时生效(该值小于minCols时,以minCols为准)
    minRows: 1, // 最少行数(当初始化数据小于该值时,以该值为准)
    minCols: 1, // 最少列数(当初始化数据小于该值时,以该值为准)
    minSpareCols: 0, // 列的最小留白数
    minSpareRows: 0, // 行的最小留白数

    // colHeaders: ["V", "Ti（NTM）", "Ti（ETM）"], // 自定义表格的表头、
    rowHeaders: false, // 是否展示行表头,默认是1,2,3等数据,可以['行1','行2']进行自定义展示
    // colWidths: [300,100,200,200], // 列宽度
    rowHeights: 40,
    // colHeight:300,
    dropdownMenu: false, // 表头展示下拉菜单,可以自定义展示
    
    currentRowClassName: "my-selectRow", // 给选中行添加自定义class类名
    currentColClassName: "my-selectCol", // 给选中列添加自定义class类名
    autoWrapRow: false, // 文字是否自动换行(当没有设置colWidths时生效)
    fixedRowsTop: 0, // 列表内容从上面开始,固定定位的行数(不包含行表头)
    fixedColumnsLeft: 0, // 列表内容从左面开始,固定定位的列数(不包含列表头)
    fillHandle: true, // 是否开启拖拽复制操作(true,false,'horizontal'水平复制,'vertical'垂直复制)
    mergeCells: false,

    // enable the `MergeCells` plugin
    // and merge specific cells at initialization
    mergeCells: [
        // merge cells from cell (1,1) to cell (3,3)
        // {
        //     row: 0,
        //     col: 0,
        //     rowspan: 1,
        //     colspan: 4
        // },
        // {
        //     row: 1,
        //     col: 1,
        //     rowspan: 1,
        //     colspan: 2
        // },
        // merge cells from cell (3,4) to cell (2,2)
 
        // merge cells from cell (5,6) to cell (3,3)

    ],
    contextMenu: {
        // 单元格右击展示菜单
        items: {
            row_above: {
                name: "上面插入一行",
            },
            row_below: {
                name: "下面插入一行",
            },
            col_left: {
                name: "左侧插入一列",
            },
            col_right: {
                name: "右侧插入一列",
            },
            remove_row: {
                name: "移除本行",
            },
            remove_col: {
                name: "移除本列",
            },
            alignment: {
                name: "对齐方式",
            },
            make_read_only: {
                name: "只读",
            },
            // 'borders':{
            //   name: '边框'
            // },
            copy: {
                name: "复制",
            },
            cut: {
                name: "剪切",
            },
            separator: Handsontable.plugins.ContextMenu.SEPARATOR,
            clear_custom: {
                name: "清空所有单元格数据",
                callback: function () {
                    this.clear();
                },
            },
        },
    },
}

let hotSettings = {
    ...htpublic,
    colHeaders: true, // 是否展示列表头,默认是A,B,C等字母,可以['列1','列2']进行自定义展示
    width:820,
    className: ["htMiddle","htCenter"], // 单元格文字对齐方式(htLeft,htRight,htCenter)
    colWidths: [300,100,200,200], // 列宽度
    
}
let headerSetting = {
    ...htpublic,
    cell: [
        {
          row: 0,
          col: 0,
          className:["htMiddle","htCenter",'custom-cell'],
        },
        {
            row: 1,
            col: 0,
            className:["htMiddle","htCenter",'custom-cell-last'],
        },
        {
            row: 1,
            col: 1,
            className:["htMiddle","htCenter",'custom-cell-last'],
        },
        {
            row: 1,
            col: 2,
            className:["htMiddle","htLeft",'custom-cell-last'],
        },
        {
            row: 1,
            col: 3,
            className:["htMiddle","htRight",'custom-cell-last'],
        },
      ],
    colHeaders: false, // 是否展示列表头,默认是A,B,C等字母,可以['列1','列2']进行自定义展示
    // colWidths: [300,100,200,200], // 列宽度
    className: ["htMiddle","htCenter"], // 单元格文字对齐方式(htLeft,htRight,htCenter)
    mergeCells: [
        // merge cells from cell (1,1) to cell (3,3)
        {
            row: 0,
            col: 0,
            rowspan: 1,
            colspan: 4
        },
        {
            row: 1,
            col: 1,
            rowspan: 1,
            colspan: 2
        },
    ],
}
let footerSetting = {
    colHeaders: false,
    ...htpublic,
    className: ["htMiddle","htleft"],
    colWidths: [400,400], // 列宽度
    rowHeights: 30,
}
export { hotSettings,headerSetting,footerSetting,htpublic}